/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: nu uc
 * License Type: Evaluation
 */
package org.testis.orm.classes;

import org.orm.*;
import org.testis.orm.refinedclasses.Identifier;

public class T_test_teststeps implements Identifier {
    public T_test_teststeps() {
    }

    public boolean save() throws PersistentException {
	try {
	    org.testis.orm.manager.TestisDbPersistentManager.instance()
		    .saveObject(this);
	    return true;
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public boolean delete() throws PersistentException {
	try {
	    org.testis.orm.manager.TestisDbPersistentManager.instance()
		    .deleteObject(this);
	    return true;
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public boolean refresh() throws PersistentException {
	try {
	    org.testis.orm.manager.TestisDbPersistentManager.instance()
		    .getSession().refresh(this);
	    return true;
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public boolean evict() throws PersistentException {
	try {
	    org.testis.orm.manager.TestisDbPersistentManager.instance()
		    .getSession().evict(this);
	    return true;
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    public boolean deleteAndDissociate() {
	try {
	    org.testis.orm.classes.T_test_labelpairs[] lT_test_labelpairss = t_test_labelpairs
		    .toArray();
	    for (int i = 0; i < lT_test_labelpairss.length; i++) {
		lT_test_labelpairss[i].setTestStep(null);
	    }
	    org.testis.orm.classes.T_testpart_condition[] lT_testpart_conditions = t_testpart_condition
		    .toArray();
	    for (int i = 0; i < lT_testpart_conditions.length; i++) {
		lT_testpart_conditions[i].setTestStep(null);
	    }
	    return delete();
	} catch (Exception e) {
	    e.printStackTrace();

	}
	return false;
    }

    public boolean deleteAndDissociate(org.orm.PersistentSession session)
	    throws PersistentException {
	try {
	    org.testis.orm.classes.T_test_labelpairs[] lT_test_labelpairss = t_test_labelpairs
		    .toArray();
	    for (int i = 0; i < lT_test_labelpairss.length; i++) {
		lT_test_labelpairss[i].setTestStep(null);
	    }
	    org.testis.orm.classes.T_testpart_condition[] lT_testpart_conditions = t_testpart_condition
		    .toArray();
	    for (int i = 0; i < lT_testpart_conditions.length; i++) {
		lT_testpart_conditions[i].setTestStep(null);
	    }
	    try {
		session.delete(this);
		return true;
	    } catch (Exception e) {
		return false;
	    }
	} catch (Exception e) {
	    e.printStackTrace();
	    throw new PersistentException(e);
	}
    }

    private java.util.Set this_getSet(int key) {
	if (key == org.testis.orm.manager.ORMConstants.KEY_T_TEST_TESTSTEPS_T_TEST_LABELPAIRS) {
	    return ORM_t_test_labelpairs;
	} else if (key == org.testis.orm.manager.ORMConstants.KEY_T_TEST_TESTSTEPS_T_TESTPART_CONDITION) {
	    return ORM_t_testpart_condition;
	}

	return null;
    }

    org.orm.util.ORMAdapter _ormAdapter = new org.orm.util.AbstractORMAdapter() {
	public java.util.Set getSet(int key) {
	    return this_getSet(key);
	}

    };

    private int id;

    private String name;

    private int modulTypeId;

    private Integer supportedDeviceGroupId;

    private int actionId;

    private String description;

    private java.util.Set ORM_t_test_labelpairs = new java.util.HashSet();

    private java.util.Set ORM_t_testpart_condition = new java.util.HashSet();

    private void setId(int value) {
	this.id = value;
    }

    public int getId() {
	return id;
    }

    public int getORMID() {
	return getId();
    }

    public void setName(String value) {
	this.name = value;
    }

    public String getName() {
	return name;
    }

    public void setModulTypeId(int value) {
	this.modulTypeId = value;
    }

    public int getModulTypeId() {
	return modulTypeId;
    }

    public void setSupportedDeviceGroupId(int value) {
	setSupportedDeviceGroupId(new Integer(value));
    }

    public void setSupportedDeviceGroupId(Integer value) {
	this.supportedDeviceGroupId = value;
    }

    public Integer getSupportedDeviceGroupId() {
	return supportedDeviceGroupId;
    }

    public void setActionId(int value) {
	this.actionId = value;
    }

    public int getActionId() {
	return actionId;
    }

    public void setDescription(String value) {
	this.description = value;
    }

    public String getDescription() {
	return description;
    }

    private void setORM_T_test_labelpairs(java.util.Set value) {
	this.ORM_t_test_labelpairs = value;
    }

    private java.util.Set getORM_T_test_labelpairs() {
	return ORM_t_test_labelpairs;
    }

    public final org.testis.orm.classes.T_test_labelpairsSetCollection t_test_labelpairs = new org.testis.orm.classes.T_test_labelpairsSetCollection(
	    this,
	    _ormAdapter,
	    org.testis.orm.manager.ORMConstants.KEY_T_TEST_TESTSTEPS_T_TEST_LABELPAIRS,
	    org.testis.orm.manager.ORMConstants.KEY_T_TEST_LABELPAIRS_TESTSTEP,
	    org.testis.orm.manager.ORMConstants.KEY_MUL_ONE_TO_MANY);

    private void setORM_T_testpart_condition(java.util.Set value) {
	this.ORM_t_testpart_condition = value;
    }

    private java.util.Set getORM_T_testpart_condition() {
	return ORM_t_testpart_condition;
    }

    public final org.testis.orm.classes.T_testpart_conditionSetCollection t_testpart_condition = new org.testis.orm.classes.T_testpart_conditionSetCollection(
	    this,
	    _ormAdapter,
	    org.testis.orm.manager.ORMConstants.KEY_T_TEST_TESTSTEPS_T_TESTPART_CONDITION,
	    org.testis.orm.manager.ORMConstants.KEY_T_TESTPART_CONDITION_TESTSTEP,
	    org.testis.orm.manager.ORMConstants.KEY_MUL_ONE_TO_MANY);

    public String toString() {
	return toString(false);
    }

    public String toString(boolean idOnly) {
	if (idOnly) {
	    return String.valueOf(getId());
	} else {
	    StringBuffer sb = new StringBuffer();
	    sb.append("T_test_teststeps[ ");
	    sb.append("Id=").append(getId()).append(" ");
	    sb.append("Name=").append(getName()).append(" ");
	    sb.append("ModulTypeId=").append(getModulTypeId()).append(" ");
	    sb.append("SupportedDeviceGroupId=")
		    .append(getSupportedDeviceGroupId()).append(" ");
	    sb.append("ActionId=").append(getActionId()).append(" ");
	    sb.append("Description=").append(getDescription()).append(" ");
	    sb.append("T_test_labelpairs.size=")
		    .append(t_test_labelpairs.size()).append(" ");
	    sb.append("T_testpart_condition.size=")
		    .append(t_testpart_condition.size()).append(" ");
	    sb.append("]");
	    return sb.toString();
	}
    }

}
